home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-07-03 | 4.1 KB | 108 lines | [TEXT/R*ch] |
- (* OS.FileSys -- SML Standard Library *)
-
- type dirstream
- datatype access = A_READ | A_WRITE | A_EXEC
-
- val openDir : string -> dirstream
- val readDir : dirstream -> string
- val rewindDir : dirstream -> unit
- val closeDir : dirstream -> unit
-
- val chDir : string -> unit
- val getDir : unit -> string
- val mkDir : string -> unit
- val rmDir : string -> unit
- val isDir : string -> bool
-
- val realPath : string -> string
- val isLink : string -> bool
- val readLink : string -> string
-
- val modTime : string -> Time.time
- val setTime : string * Time.time option -> unit
- val remove : string -> unit
- val rename : {old: string, new: string} -> unit
- val access : string * access list -> bool
-
- val tmpName : {dir : string option, prefix : string option} -> string
-
- (* These functions operate on the file system. They raise OS.SysErr
- in case of errors.
-
- [openDir p] opens directory p and returns a directory stream for
- use by readDir, rewindDir, and closeDir. Subsequent calls to
- readDir will return the directory entries in some unspecified
- order.
-
- [readDir dstr] returns and consumes a file name from the directory
- stream. If the directory stream is empty (all entries have been
- read), then the empty string "" is returned.
-
- [rewindDir dstr] resets the directory stream as if it had just been
- opened.
-
- [closeDir dstr] closes the directory stream. All subsequent
- operations on the stream will raise OS.SysErr.
-
- [chDir p] changes the current working directory to p. This affects
- calls to the functions use, load, compile in the interactive
- system, as well as all functions defined in this library. If p
- specifies a volume name, then this command also changes the current
- volume (relevant under DOS, Windows, OS/2, etc.).
-
- [getDir ()] returns the name of the current working directory.
-
- [mkDir p] creates directory p on the file system.
-
- [rmDir p] removes directory p from the file system.
-
- [isDir p] tests whether p is a directory.
-
- [realPath p] returns a canonical form of path p, where all
- occurrences of the arcs ".", "..", "" have been expanded or
- removed, and (under Unix) symbolic links have been fully expanded.
- Raises SysErr if a directory on the path, or the file or directory
- named, does not exist or is not accessible, or if there is a link
- loop.
-
- [isLink p] returns true if p names a symbolic link. Raises SysErr
- if the file does not exist or there is an access violation. On
- operating systems without symbolic links, it returns false, or
- raises SysErr if the file does not exist or there is an access
- violation.
-
- [readLink p] returns the contents of the symbolic link p. Raises
- SysErr if p does not exist or is not a symbolic link, or there is
- an access violation. On operating systems without symbolic links,
- it raises SysErr.
-
- [modTime p] returns the modification time of file p.
-
- [setTime (p, tmopt)] sets the modification and access time of file
- p. If tmopt is SOME t, then the time t is used; otherwise the
- current time, that is, Time.now(), is used.
-
- [remove p] deletes file p from the file system.
-
- [rename {old, new}] changes the name of file `old' to `new'.
-
- [access (p, accs)] tests the access permissions of file p,
- expanding symbolic links as necessary. If the list accs of
- required access permission is empty, it tests whether p exists. If
- accs contains A_READ, A_WRITE, or A_EXEC, respectively, it tests
- whether the user process has read, write, or execute permission for
- the file. Never raises an exception.
-
- [tmpName {dir, prefix}] returns a file name suitable for creating a
- fresh temporary file. Note that there is no guarantee that the
- file name will be unique, since a file of that name may be created
- between the call to tmpName and a subsequent call to open_out which
- creates the file.
-
- If dir is SOME d, then directory d is used; otherwise a
- system-dependent default directory is used (typically /tmp under
- Unix and C:\tmp under DOS). If prefix is SOME p, then the name of
- the file will consist of the prefix p followed by six letters or
- digits; otherwise a default prefix is used.
- *)
-